//
//  Search_HZTableViewCell.m
//  HZ_Beautiful_Music
//
//  Created by dllo on 16/3/31.
//  Copyright © 2016年 ui. All rights reserved.
//

#import "Search_HZTableViewCell.h"

@implementation Search_HZTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
//        _titleLabel.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_titleLabel];
        
        self.deleteButton = [UIButton buttonWithType:UIButtonTypeSystem];
        _deleteButton.frame = CGRectZero;
//        _deleteButton.backgroundColor = [UIColor grayColor];
        [_deleteButton setImage:[[UIImage imageNamed:@"Delete32"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
        [_deleteButton addTarget:self action:@selector(DeleteButtonAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:_deleteButton];
        
    }
    return self;
}

-(void)layoutSubviews {
    [super layoutSubviews];
    _titleLabel.frame = CGRectMake(0, 0, self.bounds.size.width/1.2, self.bounds.size.height);
    _deleteButton.frame = CGRectMake( self.bounds.size.width/1.1, 0, self.bounds.size.width/15, self.bounds.size.height);
}

#pragma mark - delete按钮的点击事件
-(void)DeleteButtonAction:(UIButton *)sender {
    [self.removedelegata Removeself];
}






@end
